$(document).ready(function (e) {
    $("#menu > li").hover(function () {
        $(this).addClass("dropDown");
        //$(this).children(".dropDownBox").show("slow");
        $(this).children(".dropDownBox").slideDown("fast");
    }, function () {
        $(this).removeClass("dropDown");
        //$(this).children(".dropDownBox").hide("slow");
        $(this).children(".dropDownBox").slideUp("fast");
    });

    // Scroll
    var newPost = function () {
        var list = $("#doing ul:first"),
		  flag;
        var btUp = $("#btUp");
        var btDown = $("#btDown");
        list.height(list.find("li").length * 36);
        list.hover(function () {
            clearInterval(flag);
        }, function () {
            events();
        });
        btUp.click(function () {
            clearInterval(flag);
            $("#doing ul:first").prepend($("#doing ul:first li:last")).css("margin-top", -36);
            $("#doing ul:first").stop().animate({
                "margin-top": 0
            }, {
                duration: 1000,
                easing: "easeOutCubic"
            });
        });
        btDown.click(function () {
            clearInterval(flag);
            list.append($("#doing ul:first li:first")).css("margin-top", 0);
            $("#doing ul:first").stop().animate({
                "margin-top": -36
            }, {
                duration: 1000,
                easing: "easeOutCubic"
            });
        });
        var events = function () {
            clearInterval(flag);
            flag = setInterval(function () {
                animents();
            }, 3000);
        };
        var animents = function () {
            $("#doing ul:first").stop().animate({
                "margin-top": -36
            }, {
                duration: 1000,
                easing: "easeOutCubic",
                complete: function () {
                    list.append($("#doing ul:first li:first")).css("margin-top", 0);
                }
            });
        };
        events();
    };
    $(function () {
        newPost();
    });
});